use "$Data_generated/Commune.dta", clear
gen max=0.008
egen mean_sect1e=mean(nb_sectperm) if nopol==1 & Pasc<0.3365316 & !missing(Pasc), by(year)
egen mean_sect2e=mean(nb_sectperm) if nopol==1 & Pasc>=0.3365316 & !missing(Pasc), by(year)
egen mean_sect3e=mean(nb_sectperm) if nopol==0 & Pasc<0.3365316 & !missing(Pasc), by(year)
egen mean_sect4e=mean(nb_sectperm) if nopol==0 & Pasc>=0.3365316 & !missing(Pasc), by(year)
egen mean_sect1=mean(mean_sect1e), by(year)
egen mean_sect2=mean(mean_sect2e), by(year)
egen mean_sect3=mean(mean_sect3e), by(year)
egen mean_sect4=mean(mean_sect4e), by(year)
duplicates drop year, force
tsset year
twoway (bar max year if inrange(year, 1926.5, 1927.5), color(gs12)) (line mean_sect1 mean_sect2 mean_sect3 mean_sect4 year if year>1915, xtitle("Year") ytitle("Nb of Branches") xlabel(1921(1)1936) lcolor(gs3 gs6 gs9 gs12) legend(order(2 "Low Religiosity/Anti-AF" 3 "High Religiosity/Anti-AF" 4 "Low Religiosity/No Anti-AF" 5 "High Religiosity/No Anti-AF")) scheme(stcolor_alt) text(50 1927 "Condemnation", orientation(vertical))) (scatter mean_sect1 mean_sect2 mean_sect3 mean_sect4 year if year>1920 & year<1936, mcolor(gs3 gs6 gs9 gs12) msymbol(T S C D))
graph export "$Figures/Figure5b.pdf", name(Graph) replace
graph export "$Figures/Figure5b.png", name(Graph) replace